<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="utf-8">
		<title>j1007_3_attr()</title>
		<script src="js/jquery-2.1.1.js"></script>

		<script src="js/jquery-2.1.1.min.js"></script>
	<script>
		$(document).ready(function(){
			
			//속성검사
			$('#btn01').click(function(){
				alert('이미지객체의 너비:'+$('img').attr('width'));
			});
			
			//속성변경1
			$('#btn02').click(function(){
				$('img').attr('width',150);
			});
			
			//속성제거
			$('#btn04').click(function(){
				$('img').removeAttr('width');
			});
			
			//속성변경2
			$('#btn03').click(function(){
				$('img').attr('width',function(index){
					return (index+1)*100;
				});
			});
			
			//속성변경3
			$('#btn033').click(function(){
				$('img').attr({'width':function(index){
					return (index+1)*100;
				},
				'height':150
			
				});
			});
			
		});//end of $(document).ready()
	</script>
	</head>

	<body>
		<button id="btn01">속성추가</button>
		<button id="btn02">속성변경1</button>
		<button id="btn03">속성변경2</button>
		<button id="btn033">속성변경3</button>
		<button id="btn04">속성제거</button>
		<br/>
		<img src="images/etc/img_navsprites.gif" width="250"/>
		<img src="images/etc/img_navsprites.gif" width="230"/>
	</body>
</html>
